package com.hrms.service;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.restlet.resource.ClientResource;

import com.hrms.domain.Employee;

/**
 * Servlet implementation class TestRestlet
 */
public class TestRestlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

    /**
     * Default constructor. 
     */
    public TestRestlet() {
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		
		//Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null)); 
		
        ClientResource cr = new ClientResource("http://tcshrms.appspot.com/RestletService");
        // Retrieve a representation

        EmployeeRes ec = cr.wrap(EmployeeRes.class);
        
		Employee e = ec.count();
		
		System.out.println(e.getName());
        System.out.println(cr.get().getText());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}

